# RPN-Calculator
A commandline [Reverse Polish Notation](https://en.wikipedia.org/wiki/Reverse_Polish_notation) Calculator built from Python, nothing fancy.

# Installation
Requires Python 2.7 or above. You can clone the repository or download as a ZIP, then run from terminal with:
```bash
python <install directory>
```
 
# Usage
Once the script is launched, you can enter numbers or operators one at a time. Available operators are addition (+),
subtraction (-), multiplication(*), and division(/)

```
Enter an operator or number: 1
Result: 1.0
Remaining Operands: [1.0]

Enter an operator or number: 3
Result: 3.0
Remaining Operands: [1.0, 3.0]

Enter an operator or number: 5
Result: 5.0
Remaining Operands: [1.0, 3.0, 5.0]

Enter an operator or number: -
Result: -2.0
Remaining Operands: [1.0, -2.0]

Enter an operator or number: /
Result: -0.5
Remaining Operands: [-0.5]

Enter an operator or number: q
```

## Commands
```markdown
| Shortcut  | Action                        | 
|-----------|-------------------------------|
| q         | Quits the application         |
| c         | Clears the Remaining Operands |
```

# Overview

Calculator composes of 2 parts: a "front end" script to handle user interaction and exceptions, and the RPN class 
representing the actual calculator and performing calculations in Reverse Polish Notation. This was done to 
decouple the CLI interface from the functionality of the calculator itself, so that it can theoretically work with any 
interface.

Given more time, I would have made the operand list variable private and created corresponding get/set/append methods.
Also, the add/sub/mult/div methods are made public purposefully but currently lack proper checks for things like operand
list length, etc. 